{% extends 'base_jgdw.html' %}
{% load staticfiles %}
{% block title %}
    <title>河南省农业行政执法机构队伍管理平台</title>
{% endblock %}
{% block css %}
    <style>
        td, th {
            text-align: center
        }
        .mytd0 {
            min-width: 28px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        .mytd1 {
            min-width: 45px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .mytd2 {
            min-width: 50px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .mytd3 {
            max-width:210px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .mytd4 {
            max-width: 85px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }


    </style>
{% endblock %}

{% block body %}
    <div class="container" style="padding: 0px">
        <hr>
        <div class="panel panel-info">
            <div class="panel-heading">
                <h3 class="panel-title" style="font-size: 20px;font-weight: bolder">
                    {% if user.level == '1' %}{{ user.organization.xingzhengquhua.sheng }}{% elif user.level == '2' %}
                        {{ user.organization.xingzhengquhua.shi }}{% endif %}农业综合行政执法机构列表
                </h3>
            </div>
            <div class="panel-body">
                <div class="table-responsive">
                    <table class="table table-hover">
                        <thead>
                        <tr>
                            <th> 序号</th>
                            <th> 单位名称</th>
                            <th> 单位地址</th>
                            <th> 负责人</th>
                            <th> 负责人电话</th>
                            <th> 联系人</th>
                            <th> 联系人电话</th>
                            <th> 编制数</th>
                            <th> 单位性质</th>
                            <th> 车辆数</th>
                            <th> 经费</th>
                        </tr>
                        </thead>
                        <tbody>
                        {% for foo in list %}
                            <tr class="foo">
                                <td><div class="mytd0">{{ forloop.counter }}</div></td>
                                <td>
                                    <div class="mytd3">{{ foo.title }}</div>
                                </td>
                                <td>
                                    <div class="mytd3">{{ foo.address }}</div>
                                </td>
                                <td>
                                    <div class="mytd2">{{ foo.fzr }}</div>
                                </td>
                                <td>
                                    <div class="mytd2">{{ foo.phone1 }}</div>
                                </td>
                                <td>
                                    <div class="mytd2">{{ foo.lxr }}</div>
                                </td>
                                <td>
                                    <div class="mytd2">{{ foo.phone2 }}</div>
                                </td>
                                <td>
                                    <div class="mytd1">{% if foo.bianzhi %}
                                        {{ foo.bianzhi }}
                                    {% endif %}</div>
                                </td>
                                <td>
                                    <div class="mytd4">
                                        {% if foo.dwxz %}
                                            {{ foo.get_dwxz_display }}
                                        {% endif %}
                                    </div>
                                </td>
                                <td>
                                    <div class="mytd1">{% if foo.che %}
                                        {{ foo.che }}
                                    {% endif %}</div>
                                </td>
                                <td>
                                    <div class="">{% if foo.jingfei %}
                                        {{ foo.jingfei }}
                                    {% endif %}</div>
                                </td>
                            </tr>
                        {% endfor %}
                        </tbody>
                    </table>
                    <ul class="pagination pagination-sm pull-right">
                        {{ page_obj.page_str|safe }}
                    </ul>
                </div>
            </div>
        </div>
    </div>
{% endblock %}
{% block js %}
    <script>
        $('.pagination ').append('<li><a href="/download/jg/"><span class="glyphicon glyphicon-download-alt"></span></a></li>')
        $(".ok").click(function () {
            id = $(this).attr("id")
            td = $(this).parents('tr').children('td').eq(8)
            $.ajax({
                url: "/zfry_shtg/" + id + "/",
                type: "get",
                dataType: "json",
                success: function (arg) {
                    if (arg.status == 200) {
                        td.text('已审核')
                    } else if (arg.status == 400) {
                        swal('出错了', '您的权限不足，审核失败！', 'warning')
                    }
                }
            })
        })
        $(".notok").click(function () {
            id = $(this).attr("id")
            td = $(this).parents('tr').children('td').eq(8)
            $.ajax({
                url: "/zfry_shbtg/" + id + "/",
                type: "get",
                dataType: "json",
                success: function (arg) {
                    if (arg.status == 200) {
                        td.text('未审核')
                    } else if (arg.status == 400) {
                        swal('出错了', '您的权限不足，审核失败！', 'warning')
                    }
                }
            })
        })
        $('tr').hover(function () {
            {#alert(100)#}
        })
    </script>
{% endblock %}



